import { createRouter, createWebHashHistory } from 'vue-router'
import Layout from '@/layout/index.vue'
/*
	菜单展示文字 和tab展示 name，meta里的title暂无使用
*/
const routes = [
  {
    path: '/',
    redirect: '/login', //重定向url地址
    hidden: true
  },
  {
    path: '/login',
    name: 'Login',
    meta: { title: 'login' },
    hidden: true,
    component: () => import('../views/Login/index.vue')
  },
  {
    path: '/404',
    name: '404',
    meta: { title: '404' },
    hidden: true,
    component: () => import('../views/public/404.vue')
  },
  {
    path: '/Home',
    name: 'home',
    component: Layout,
    meta: { title: '' },
    redirect: '/Home/index',
    children: [
      {
        path: '/Home/index',
        name: '首页',
        meta: { title: '首页' },
        component: () => import('../views/Home/index.vue')
      }
    ]
  },
  {
    path: '/mgmt',
    name: '系统管理',
    meta: { title: '系统管理' },
    component: Layout,
    children: [
      {
        path: '/mgmt/mgmtUser', //这里加 /  就在地址栏直接显示 /mgmtUser
        name: '用户管理',
        meta: { title: '用户管理' },
        component: () => import('../views/Mgmt/MgmtUser/index.vue')
      },
      {
        path: '/mgmt/mgmtMenu',
        name: '菜单管理',
        meta: { title: '菜单管理' },
        component: () => import('../views/Mgmt/MgmtMenu/index.vue')
      },
      {
        path: '/mgmt/mgmtCard',
        name: '卡片管理',
        meta: { title: '卡片管理' },
        component: () => import('../views/Mgmt/MgmtCard/index.vue')
      },
      {
        path: '/mgmt/mgmtRole',
        name: '角色管理',
        meta: { title: '角色管理' },
        component: () => import('../views/Mgmt/MgmtRole/index.vue')
      },
      {
        path: '/mgmt/mgmtDict',
        name: '记账管理',
        meta: { title: '记账管理' },
        component: () => import('../views/Mgmt/MgmtDict/index.vue')
      }
    ]
  },
  {
    path: '/elementPlus',
    name: '饿了吗3组件',
    meta: { title: '饿了吗3组件' },
    component: Layout,
    children: [
      {
        path: '/elementPlus/table',
        name: '表格',
        meta: { title: '表格' },
        component: () => import('../views/Element/table/index.vue')
      },
      {
        path: '/elementPlus/calendar',
        name: '日历',
        meta: { title: '日历' },
        component: () => import('../views/Element/calendar/calendar.vue')
      },
      {
        path: '/elementPlus/form',
        name: '表单',
        meta: { title: '表单' },
        component: () => import('../views/Element/form/index.vue')
      }
    ]
  },
  //个人中心
  {
    path: '/user',
    name: '',
    component: Layout,
    meta: { title: '' },
    redirect: '/user/userCenter',
    children: [
      {
        path: '/user/userCenter',
        name: '个人中心',
        meta: { title: '个人中心' },
        component: () => import('../views/UserCenter/index.vue')
      }
    ]
  },
  //知识库
  {
    path: '/knowledge',
    name: '',
    meta: { title: '' },
    redirect: '/knowledge/index',
    component: Layout,
    children: [
      {
        path: '/knowledge/index',
        name: '知识库',
        meta: { title: '知识列表' },
        component: () => import('../views/Knowledge/index.vue')
      },
      {
        path: '/knowledge/detail',
        name: '详情',
        hidden: true,
        meta: { title: '详情' },
        component: () => import('../views/Knowledge/detail.vue')
      },
      {
        path: '/knowledge/new',
        name: '新建',
        hidden: true,
        meta: { title: '新建' },
        component: () => import('../views/Knowledge/new.vue')
      },
      {
        path: '/knowledge/edit',
        name: '编辑',
        hidden: true,
        meta: { title: '编辑' },
        component: () => import('../views/Knowledge/new.vue')
      }
    ]
  },
  // 我的会议
  {
    path: '/meeting',
    name: '会议',
    meta: { title: '' },
    redirect: '/meeting/index',
    component: Layout,
    children: [
      {
        path: '/meeting/index',
        name: '会议管理',
        meta: { title: '会议管理' },
        component: () => import('../views/Meeting/index.vue')
      }
    ]
  }
]

const router = createRouter({
  history: createWebHashHistory(), //哈希模式
  routes
})

export default router
